package giab.weixin.web.util;

import java.security.MessageDigest;

import org.apache.commons.codec.binary.Hex;

public class MD5Util {
	/**
	* @author 张怡菲
	* @createTime 	2013-5-9 下午3:48:24
	* @Title: getMD5
	* @Description: 将字符串加密
	* @param str  加密后的HEX字符串
	* @return    String
	* @modifyTime	2013-5-9 下午3:48:24
	* 
	*/
	
	public static String getMD5(String str) {
		MessageDigest mdInst = null;
		String encodeStr = "";
		try {
			mdInst = MessageDigest.getInstance("MD5");
			mdInst.update(str.getBytes());
			encodeStr = Hex.encodeHexString(mdInst.digest());
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return encodeStr.toUpperCase();
	}
	
	
	
}
